home *** CD-ROM | disk | FTP | other *** search
- /*
- Display a message in a generic alert.
- Comes up positioned by upper left of front window, which
- presumably should be the window in which occurred the event to which the
- alert applies.
-
- SetMessageAlertNum () should be called early to set the alert resource number.
- */
-
- # include "TransSkel.h"
-
- # include "Boxes.h"
-
-
- short alrtNum = 0;
-
-
-
- /* Public routine prototypes - copy into project main header file */
-
- void SetMessageAlertNum (short alrtNum);
- void Message1 (StringPtr s1);
- void Message2 (StringPtr s1, StringPtr s2);
- void Message3 (StringPtr s1, StringPtr s2, StringPtr s3);
- void Message4 (StringPtr s1, StringPtr s2, StringPtr s3, StringPtr s4);
-
-
- void SetMessageAlertNum (short n)
- {
- alrtNum = n;
- }
-
-
- void Message4 (StringPtr s1, StringPtr s2, StringPtr s3, StringPtr s4)
- {
- AlertTHndl h;
- Rect r;
- WindowPtr w = FrontWindow ();
- Point pt;
-
- h = (AlertTHndl) GetResource ('ALRT', alrtNum);
- if (h != nil)
- {
- if (w != nil)
- {
- pt.h = w->portRect.left;
- pt.v = w->portRect.top;
- LocalToGlobal (&pt);
- }
- else
- SetPt (&pt, 40, 50);
- HNoPurge ((Handle) h);
- LoadResource ((Handle) h);
- HLock ((Handle) h);
- r = (**h).boundsRect;
- OffsetRect (&r, -r.left, -r.top); /* to (0, 0) */
- OffsetRect (&r, pt.h + 10, pt.v + 10); /* to upper left of front window */
- (**h).boundsRect = r;
- HUnlock ((Handle) h);
- }
- SetCursor (&arrow);
- ParamText (s1, s2, s3, s4);
- (void) Alert (alrtNum, SkelDlogFilter (nil, true));
- SkelRmveDlogFilter ();
- if (h != nil)
- ReleaseResource ((Handle) h);
- SkelDoUpdates ();
- }
-
-
- void Message1 (StringPtr s1)
- {
- Message4 (s1, (StringPtr) "\p", (StringPtr) "\p", (StringPtr) "\p");
- }
-
-
- void Message2 (StringPtr s1, StringPtr s2)
- {
- Message4 (s1, s2, (StringPtr) "\p", (StringPtr) "\p");
- }
-
-
- void Message3 (StringPtr s1, StringPtr s2, StringPtr s3)
- {
- Message4 (s1, s2, s3, (StringPtr) "\p");
- }
-